package com.swagger.knife4jdemo.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author 哲思小辉
 * @version 1.0.0
 * @ClassName CityEntity.java
 * @Description 城市实体
 * @Param
 * @createTime 2020年03月24日 16:55:00
 */
@Setter
@Getter
@ApiModel(value = "CityEntity", description = "城市实体")
@AllArgsConstructor
public class CityEntity implements Serializable {
    @ApiModelProperty(name = "cityId", value = "城市Id", dataType = "Long", example = "166666666666666")
    private Long cityId;

    @ApiModelProperty(name = "cityName", value = "城市名称", example = "丽江市")
    @NotBlank(message = "城市名称为空")
    @Size(min = 2, max = 20, message = "城市名称长度范围2~20个字符")
    private String cityName;

    @ApiModelProperty(name = "cityCode", value = "城市编码", example = "0888")
    @NotNull(message = "城市编码不为null")
    @Digits(integer = 3, fraction = 2, message = "城市编码有毒")
    private String cityCode;

    @ApiModelProperty(name = "cityLevel", value = "城市等级", example = "小城市")
    private String cityLevel;

    @ApiModelProperty(name = "cityManagers", value = "城市管理者", example = "[\"张三\",\"李四\"]")
    @NotEmpty(message = "管理者为空")
    private List<String> cityManagers;

    @ApiModelProperty(name = "buildings", value = "建筑物", example = "[\"高楼\",\"平房\",\"民宿\"]")
    @Size(min = 1, max = 3, message = "建筑物个数范围1~3")
    private List<String> buildings;


    @ApiModelProperty(name = "createTime", value = "创建时间", example = "2020-03-28 09:09:20")
    @NotNull(message = "创建时间为空")
    @Pattern(regexp = "\\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{2}", message = "创建时间格式错误")
    private String createTime;

    @ApiModelProperty(name = "updateTime", value = "更新时间", example = "2020-03-28 09:09:20")
    @NotNull(message = "更新时间为空")
    @Future(message = "更新时间应该大于当前时间")
    private Date updateTime;

    @ApiModelProperty(name = "time", value = "时间", example = "2020-03-28 09:09:20")
    @NotNull(message = "时间为空")
    @Past(message = "时间应该小于当前时间")
    private Date time;


    @ApiModelProperty(name = "haveTime", value = "是否有时间", example = "true")
    @AssertTrue(message = "没有时间")
    private Boolean haveTime;

    @ApiModelProperty(name = "money", value = "财富值", example = "165454545554554.254")
    @DecimalMax(value = "165454545454787841", message = "超过系统所能承受的财富值")
    @DecimalMin(value = "56465455455445", message = "未能达到系统所能承受的财富值")
    private BigDecimal money;

    @ApiModelProperty(name = "email", value = "邮箱", example = "89787987@qq.com")
    @Email(message = "邮箱格式不对")
    private String email;

    @ApiModelProperty(name = "status", value = "状态为null", example = "null")
//    @Null(message = "状态为null")
    @Min(value = 200, message = "不能小于200")
    private String status;

    @ApiModelProperty(name = "count", value = "数量", example = "10")
    @PositiveOrZero(message = "数量应该大于等于0")
    private Integer count;

    @ApiModelProperty(name = "total", value = "总数量", example = "1")
    @NegativeOrZero(message = "总数量应该小于等于0")
    private Integer total;


    public CityEntity(long cityId, String cityName, String cityCode, String cityLevel) {
        this.cityId = cityId;
        this.cityName = cityName;
        this.cityCode = cityCode;
        this.cityLevel = cityLevel;
    }
}
